import React, {Component} from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Alert,
    TouchableHighlight,
    TouchableOpacity,
    Modal,
    Dimensions,
    Image
} from 'react-native';

var width = Dimensions.get('window').width;
var height = Dimensions.get('window').height;
export default class PhotoView extends Component {
    constructor(props) {
        super(props);
        this.state = {
            isShow: false,
            uri: ''
        }
    }

    pressAction(source) {

        this.setState({
            isShow: true,
            uri: source
        });

    }

    shutDown() {
        this.setState({
            isShow: false
        });
    }

    render() {
        return ( <View>
                <Modal onRequestClose={() => {}} visible={this.state.isShow} animationType='slide' transparent={true}>
                    <TouchableHighlight onPress={() => this.shutDown()}
                                        style={{ flex: 1, backgroundColor: 'rgb(0, 0, 0)',justifyContent:'center'}}>
                        <View style={{height:height,width:width,backgroundColor:'white'}}>
                            <Image
                                resizeMode={"contain"}
                                source={{uri:this.state.uri}}
                                style={{backgroundColor:'white',flex:1,width: width,height: height}}/>
                        </View>
                    </TouchableHighlight>
                </Modal>
            </View>
        )
    }
}